package cn.changeforyou.web.cloud.rpc.service.auth.dto;

import cn.changeforyou.web.cloud.rpc.common.model.BaseDTO;
import cn.changeforyou.web.cloud.rpc.service.auth.enums.OpenLevel;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;

/**
 * 角色权限表, 超级管理员不在详情内
 * @TableName source_info
 */
@Data
public class SourceInfoDTO extends BaseDTO {
    /**
     *
     */
    private Integer serviceId;

    /**
     * 1: 接口类型, 2:静态资源类型, 3:前端路由类型
     */
    private Integer resourceType;

    /**
     *
     */
    private String value;

    /**
     * 完全开放(不需要认证):1, 不完全开放(认证即可用):2, 完全控制:3, 角色控制:4, 组织控制:5
     */
    private OpenLevel openLevel;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        SourceInfoDTO that = (SourceInfoDTO) o;
        return getId() != null ? getId().equals(that.getId()) : that.getId() == null;
    }

    @Override
    public int hashCode() {
        return getId().hashCode();
    }

    @Override
    public String toString() {
        return "SourceInfoDTO{" +
                "id=" + getId() +
                ", serviceId=" + serviceId +
                ", resourceType=" + resourceType +
                ", value='" + value + '\'' +
                ", openLevel=" + openLevel +
                '}';
    }
}